5 * @subpackage SpecialPage
9 require_once("QueryPage.php");
13 * @subpackage SpecialPage
15 class UnusedimagesPage
extends QueryPage
{
18 return 'Unusedimages';
21 function sortDescending() {
24 function isSyndicated() { return false; }
27 global $wgCountCategorizedImagesAsUsed;
28 $dbr =& wfGetDB( DB_SLAVE
);
30 if ( $wgCountCategorizedImagesAsUsed ) {
31 extract( $dbr->tableNames( 'cur', 'image', 'imagelinks', 'categorylinks' ) );
33 return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description
34 FROM ((('.$cur.' AS I LEFT JOIN '.$categorylinks.' AS L ON I.cur_id = L.cl_from)
35 LEFT JOIN '.$imagelinks.' AS P ON I.cur_title = P.il_to)
36 INNER JOIN '.$image.' AS G ON I.cur_title = G.img_name)
37 WHERE I.cur_namespace = '.NS_IMAGE
.' AND L.cl_from IS NULL AND P.il_to IS NULL';
40 extract( $dbr->tableNames( 'image','imagelinks' ) );
42 return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description' .
43 ' FROM '.$image.' LEFT JOIN '.$imagelinks.' ON img_name=il_to WHERE il_to IS NULL ';
47 function formatResult( $skin, $result ) {
48 global $wgLang, $wgContLang;
49 $title = Title
::makeTitle( NS_IMAGE
, $result->title
);
51 $imageUrl = htmlspecialchars( Image
::imageUrl( $result->title
) );
53 # The 'desc' linking to the image page
54 '('.$skin->makeKnownLinkObj( $title, wfMsg('imgdesc') ).') '
55 # Link to the image itself
56 . '<a href="' . $imageUrl . '">' . htmlspecialchars( $title->getText() ) . '</a>'
58 . ' . . '.$wgLang->timeanddate($result->value
)
60 . ' . . '.$skin->makeLinkObj( Title
::makeTitle( NS_USER
, $result->img_user_text
), $result->img_user_text
)
61 # If there is a description, show it
62 . $skin->commentBlock( $result->img_description
);
67 function getPageHeader() {
68 return wfMsg( "unusedimagestext" );
76 function wfSpecialUnusedimages() {
77 list( $limit, $offset ) = wfCheckLimits();
78 $uip = new UnusedimagesPage();
80 return $uip->doQuery( $offset, $limit );